﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bymed.SpineScan.Repository.Interface
{
    /// <summary>
    /// A factory that manage every single repository.
    /// </summary>
    public interface IRepositoryFactory : IDisposable
    {
        /// <summary>
        /// Open a database connection with a transaction
        /// </summary>
        void OpenSessionWithTransaction();

        /// <summary>
        /// Open a database connection without a transaction
        /// </summary>
        void OpenSession();

        /// <summary>
        /// Rollback the transaction
        /// </summary>
        void Rollback();

        /// <summary>
        /// Commit the transaction
        /// </summary>
        void Commit();

        /// <summary>
        /// Flush current data
        /// </summary>
        void Flush();

        /// <summary>
        /// Commit the transaction based on the provided parameter and close the database connection
        /// </summary>
        void CloseSession();

        /// <summary>
        /// Create an instance of RepositoryBase against the specific DataModel type and provide standard CRUD operation only.
        /// </summary>
        /// <typeparam name="T">The provided DataModel type.</typeparam>
        /// <returns>An instance of RepositoryBase against the specific DataModel type and provide standard CRUD operation only.</returns>
        IRepository<T> CreateRepositoryBase<T>() where T : class;

        /// <summary>
        /// Create an instance of AttendingDoctorRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of AttendingDoctorRepository</returns>
        IAttendingDoctorRepository CreateAttendingDoctorRepository();

        /// <summary>
        /// Create an instance of DiagnosticMessageReferenceRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of DiagnosticMessageReferenceRepository</returns>
        IDiagnosticMessageReferenceRepository CreateDiagnosticMessageReferenceRepository();

        /// <summary>
        /// Create an instance of TestResultDiagnosticMessageRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of TestResultDiagnosticMessageRepository</returns>
        ITestResultDiagnosticMessageRepository CreateTestResultDiagnosticMessageRepository();

        /// <summary>
        /// Create an instance of PatientRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of PatientRepository</returns>
        IPatientRepository CreatePatientRepository();

        //// <summary>
        /// Create an instance of TestResultRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of TestResultRepository</returns>
        ITestResultRepository CreateTestResultRepository();

        //// <summary>
        /// Create an instance of TestTrackingRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of TestTrackingRepository</returns>
        ITestTrackingRepository CreateTestTrackingRepository();

        //// <summary>
        /// Create an instance of CustomizedTestItemRepository to do any operation against data source.
        /// </summary>
        /// <returns>An instance of CustomizedTestItemRepository</returns>
        ICustomizedTestItemRepository CreateCustomizedTestItemRepository();
    }
}
